from basic import Line, Ellipse, Rectangle, Triangle, Round
from shape import Shape

class Originator:
    def __init__(self, canvas):
        self.old_shape_list = []
        self.canvas = canvas

    def changeStatus(self, shape_list):
        self.old_shape_list.clear()
        for shape in shape_list:
            new_shape = Shape(self.canvas, shape.shape_tag, shape.color)
            for txt in shape.txt_list:
                new_shape.txt_list.append(txt)
            for basic in shape.basic_list:
                if basic.shape == 'line':
                    new_basic = Line(basic.tag, basic.id, 'line', self.canvas.coords(basic.tag))
                    new_shape.addBasic(new_basic)
                elif basic.shape == 'rectangle':
                    new_basic = Rectangle(basic.tag, basic.id, 'rectangle', self.canvas.coords(basic.tag))
                    new_shape.addBasic(new_basic)
                elif basic.shape == 'ellipse':
                    new_basic = Ellipse(basic.tag, basic.id, 'ellipse', self.canvas.coords(basic.tag))
                    new_shape.addBasic(new_basic)
                elif basic.shape == 'round':
                    new_basic = Round(basic.tag, basic.id, 'round', self.canvas.coords(basic.tag))
                    new_shape.addBasic(new_basic)
                elif basic.shape == 'triangle':
                    new_basic = Triangle(basic.tag, basic.id, 'triangle', self.canvas.coords(basic.tag))
                    new_shape.addBasic(new_basic)
            self.old_shape_list.append(new_shape)
